package com.study.practice.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.Properties;

//@Configuration
//@EnableConfigurationProperties(MyPropertiesConfig.class)
//public class PropertiesTest {
//    @Autowired
//    private MyPropertiesConfig myPropertiesConfig;
//
//    /**
//     * 可以映射application.properties中以my1test开头的所有属性
//     * @return 属性对象
//     */
//    @Bean
//    @ConfigurationProperties(prefix = "my1test")
//    public Properties myPropertiesConfig() {
//        System.out.println("config bean");
//        return new Properties();
//    }
//
//
//    @PostConstruct
//    public void init() {
//        Properties properties = this.myPropertiesConfig();
//        System.out.println(properties.getProperty("test"));
//        System.out.println(myPropertiesConfig.getTest());
//    }
//}
